; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=loop-fusion -S | FileCheck %s

define void @v_5_0(ptr %dummy) {
; CHECK-LABEL: @v_5_0(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
; CHECK:       for.cond.cleanup:
; CHECK-NEXT:    br i1 true, label [[FOR_BODY6_PREHEADER:%.*]], label [[FOR_COND_CLEANUP5:%.*]]
; CHECK:       for.body6.preheader:
; CHECK-NEXT:    br label [[FOR_BODY6:%.*]]
; CHECK:       for.body:
; CHECK-NEXT:    br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
; CHECK:       for.cond.cleanup5:
; CHECK-NEXT:    ret void
; CHECK:       for.body6:
; CHECK-NEXT:    [[V_LOOP_2_0_V_LOOP_2_0_V_LOOP_2_0_18:%.*]] = load volatile i32, ptr [[DUMMY:%.*]], align 1
; CHECK-NEXT:    br label [[FOR_BODY6]]
;
entry:
  br label %for.body

for.cond.cleanup:                                 ; preds = %for.body
  br i1 true, label %for.body6, label %for.cond.cleanup5

for.body:                                         ; preds = %for.body, %entry
  br i1 false, label %for.cond.cleanup, label %for.body

for.cond.cleanup5:                                ; preds = %for.cond.cleanup
  ret void

for.body6:                                        ; preds = %for.body6, %for.cond.cleanup
  %v_loop_2.0.v_loop_2.0.v_loop_2.0.18 = load volatile i32, ptr %dummy, align 1
  br label %for.body6
}

define void @f943(ptr %dummy) {
; CHECK-LABEL: @f943(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_COND32_I_I:%.*]]
; CHECK:       for.cond32.i.i:
; CHECK-NEXT:    br label [[FOR_BODY37_I_I:%.*]]
; CHECK:       for.cond42.preheader.i.i:
; CHECK-NEXT:    br i1 true, label [[FOR_BODY44_I_I_PREHEADER:%.*]], label [[FOR_END47_I_I:%.*]]
; CHECK:       for.body44.i.i.preheader:
; CHECK-NEXT:    br label [[FOR_BODY44_I_I:%.*]]
; CHECK:       for.body37.i.i:
; CHECK-NEXT:    br i1 true, label [[FOR_BODY37_I_I]], label [[FOR_COND42_PREHEADER_I_I:%.*]]
; CHECK:       for.body44.i.i:
; CHECK-NEXT:    store volatile i8 poison, ptr [[DUMMY:%.*]], align 1
; CHECK-NEXT:    br i1 true, label [[FOR_BODY44_I_I]], label [[FOR_END47_I_I_LOOPEXIT:%.*]]
; CHECK:       for.end47.i.i.loopexit:
; CHECK-NEXT:    br label [[FOR_END47_I_I]]
; CHECK:       for.end47.i.i:
; CHECK-NEXT:    br label [[FOR_COND32_I_I]]
;
entry:
  br label %for.cond32.i.i

for.cond32.i.i:                                   ; preds = %for.end47.i.i, %entry
  br label %for.body37.i.i

for.cond42.preheader.i.i:                         ; preds = %for.body37.i.i
  br i1 true, label %for.body44.i.i, label %for.end47.i.i

for.body37.i.i:                                   ; preds = %for.body37.i.i, %for.cond32.i.i
  br i1 true, label %for.body37.i.i, label %for.cond42.preheader.i.i

for.body44.i.i:                                   ; preds = %for.body44.i.i, %for.cond42.preheader.i.i
  store volatile i8 poison, ptr %dummy, align 1
  br i1 true, label %for.body44.i.i, label %for.end47.i.i

for.end47.i.i:                                    ; preds = %for.body44.i.i, %for.cond42.preheader.i.i
  br label %for.cond32.i.i
}

